package pl.edu.agh.uddiProxy.types;

public class TModel {
	private ServiceDynamicParameters dynamicParameter;
	private dk.itst.uddi.client.types.core.TModel model;

	public TModel(dk.itst.uddi.client.types.core.TModel model) {
		this.model = model;
	}
	
	public ServiceDynamicParameters getDynamicParameter() {
		return dynamicParameter;
	}

	public void setDynamicParameter(ServiceDynamicParameters dynamicParameter) {
		if (model != null) {
			dynamicParameter.setTModelKey(model.getTModelKey());
		}
		this.dynamicParameter = dynamicParameter;
	}

	/**
	 * @return UDDI TModel
	 */
	public dk.itst.uddi.client.types.core.TModel getModel() {
		return model;
	}
	
	/** Set TModelKey in UDDI TModel and in DynamicParameter
	 * @param key TModelKey
	 */
	public void setTModelKey(String key) {
		model.setTModelKey(key);
		dynamicParameter.setTModelKey(key);
	}
	
	@Override
	public boolean equals(Object obj) {
		return model.equals(((TModel) obj).getModel());
	}

}
